/*
 * @Author: szx
 * @Date: 2021-10-27 11:40:51
 * @LastEditTime: 2021-10-27 13:22:54
 * @Description:
 * @FilePath: \leetcode\189\189.cpp
 */
#include <iostream>
#include <vector>
using namespace std;
class Solution {
   public:
    void rotate(vector<int>& nums, int k) {
        int n = nums.size();
        if (k > n) k %= n;
        vector<int> a(n);
        for (int i = 0; i < k; i++) a[i] = nums[n - k + i];
        for (int i = 0; i < n - k; i++) a[i + k] = nums[i];
        for (int i = 0; i < n; i++) nums[i] = a[i];
    }
};

int main() { return 0; }